<template>
    <view class="shop-item">
        <!-- 图片容器（新增外层，用于定位） -->
        <view class="image-container">
            <image class="shop-image" :src="item.photos && item.photos.length > 0 ? item.photos[0].url : DEFAULT_IMAGE" mode="aspectFill"/>
            <!-- 将 name_type 移到图片容器内，绝对定位覆盖图片 -->
            <view class="name_type">
                <text class="shop-name">{{ item.name }}</text>
                <text class="shop-type">类型：{{ item.business.keytag }}</text>
            </view>
        </view>
        <!-- 原 shop-info 内容（移除 name_type） -->
        <view class="shop-info">
            <text class="shop-address" v-if="item.address">地址：{{ item.address }}</text>
			<text class="shop-time" v-if="item.business.opentime_today">营业时间：{{ item.business.opentime_today }}</text>
            <text class="shop-distance">离您：{{ Math.floor(item.distance) }}米</text>
            <text class="shop-tel" v-if="item.business.tel">电话：{{ item.business.tel }}</text>
        </view>
    </view>
</template>
<script>
export default {
    name: "ShopItem",
    props: {
        item: {
            type: Object,
            required: true
        }
    },
    data() {
        return {
            DEFAULT_IMAGE: '/static/nopic.png'
        };
    },
	methods:{
		
		
	}
	
};
</script>
<style>
/* 新增图片容器样式 */
.shop-item{
	
}
.image-container {
	background-color: antiquewhite;
    position: relative;  /* 关键：为子元素提供定位基准 */
    width: 320rpx;
    height: 350rpx;
	margin-top: 25rpx;
    border-top-right-radius: 16rpx;
    border-top-left-radius:16rpx ;
}

.shop-image {
    width: 100%;
    height: 100%;
    border-radius: inherit; /* 继承容器的圆角 */
}

/* 调整 name_type 的定位 */
.name_type {
    position: absolute;
    left: 5rpx;
    right: 5rpx;
    bottom: 5rpx;
    background-color: rgba(0,0,0,0.3);
    color: white;
    padding: 8rpx;  /* 添加内边距提升可读性 */
    display: flex;
    flex-direction: column;
}

/* 微调文字样式（可选） */
.shop-name {
    font-size: 30rpx;
    font-weight: bold;
    margin-bottom: 4rpx;
}
.shop-type {
    font-size: 26rpx;
    opacity: 0.9;
}
.shop-info {
    display: flex;
    flex-direction: column;
    width: 318rpx;
    margin-top: 10rpx;
    border-width: 1rpx;
    border-color: blue;
    padding: 5rpx;
	font-size: 28rpx;
    border-bottom-left-radius: 16rpx;
    border-bottom-right-radius: 16rpx;
    box-shadow: 0 5rpx 1rpx rgba(0, 0, 0, 0.2);
    word-break: break-all; /* 设置文本自动换行 */
}

</style>